package com.ktjy.mapper;

import com.ktjy.entity.SysUser;
import com.ktjy.service.SysUserService;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

public class Main {
    Logger logger = LoggerFactory.getLogger(Main.class);

    @Test
    public void test() {
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");

        SysUserService sysUserService = (SysUserService) context.getBean("sysUserService");
        SysUser sysUser = new SysUser();
        sysUser.setRealName("李");
        sysUser.setRoleId(2L);
        List<SysUser> userList = sysUserService.getSysUserList(sysUser);

        for (SysUser user : userList) {
            logger.info("SysUser:account={},realName={}, roleName={}", user.getAccount(),
                    user.getRealName(),
                    user.getSysRole().getRoleName());
        }
    }
}
